Repository navigation
«Baum»: parameter names on a call's edges; the box in the call node's place - #57
Merged
Merged
Conversation
… place A call of the program's own labels each argument's edge with the parameter it binds to (positional, by keyword; none after *args, for **kwargs, for a default, or for built-in functions), until the call is replaced or its box opens. The layout keeps room for the labels in each node's place, so they touch no node and no other label. A call that stays a box now sits in its node's place: a tree node of the box's measured size (ExpressionTreeBox, growth-only), several rows high (the van der Ploeg port takes a node's height into account). The tree is laid out again when the box opens and closes, and when it grows. Checks: test:tree (labels, keywords, builtins, the box in place), test:layout (flextree with tall boxes and label room on 500 call trees, no label overlapping), test:console (labels, the box under +, no overlaps, one height, no movement while the box is open). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
P44: two changes to calls in the mode «Baum».
1. Parameter names on the edges
summe(2 + 2, 3 * 4)withdef summe(x, y)labels the edge to2 + 2xand the edge to3 * 4y. The node keeps the function's name.name=node goes, since the label says it.*args(a starred argument) there are no labels, and none for**kwargs;len,max,sum) have no call-enter, so their edges stay unlabelled.xkeepsxwhile2 + 2becomes4), until the call is replaced or its box opens.2. The box in the call node's place
ExpressionTreeBoxreads its size in characters and rows of the tree, and the tree is a node of that size.bottom = y + h). The algorithm takes heights into account, andtest:layoutcompares it with d3-flextree on 500 random call trees with tall boxes.Checks
test:tree(runtime traces):summe(2 + 2, 3 * 4)givessumme(x:+(2, 2), y:*(3, 4))→summe(x:4, …)→summe(x:4, y:12)→+(4, 12)→16, and its text equals the chain;len([1, 2]) + max(2, 5)has no labels;teile(b=4, a=8)givesteile(b:4, a:8)), a default (no edge) and*[9, 3](no labels);notenschnitt([4, 5, 4.5]) + 1gives+(notenschnitt(noten:…), 1)→+(BOX, 1)→+(4.5, 1)→5.5, laid out again at the box's opening and closing.test:layout: d3-flextree agrees on 500 random call trees with boxes of 1–6 rows and with label room, and no label overlaps a node or another label.test:console(Chrome, all checks pass):xandyshow on exactly the three steps before the call is replaced;+with1beside it, and nothing moves while it's open (16 steps);test:runtime,test:protocol,test:hintsandtest:svg.Screenshots
Every step of both examples at 1000 px and 420 px (see the session report).
Manual tests
Desktop (Chrome, Safari, Firefox), an embed with
features=visualize,tree:summe(2 + 2, 3 * 4):xandybeside the edges, staying through4and12, gone at4 + 12.len([1, 2]) + max(2, 5): no labels.notenschnitt([4, 5, 4.5]) + 1: the box in place ofnotenschnittunder+, with1beside it. Step through the box: the tree stays put. Then4.5 + 1and5.5.fak(3)): boxes nested in boxes, each in its node's place.iPad (portrait and landscape), external keyboard:
Follow-ups (not done)
🤖 Generated with Claude Code